$(document).ready(
		function() {
			

			$("#content > div").hide();
			$("#content > div:eq(0)").show();
			$("#tabs > a:eq(0)").css("background",
					"url('imagens/icones/imagemBotaoHover.png')");
			$("#tabs > a:eq(0)").css("color", "black");
			var loc = location.search.substring(1, location.search.length);

			var params = loc.split("&");
			param_value = params[0].substring(params[0].indexOf('=') + 1);
			
			if ((param_value == "editar") || (param_value == "2") || (param_value == "atualizar")|| (param_value == "comprarIngresso")) {
				
				acao = document.getElementById("formCadastro").getAttribute(
						"action");
				
				var paramsForms = acao.split("?");
				
				if ((param_value == "editar") || (param_value == "atualizar")) {
					$('#formCadastro').attr(
							'action',
							paramsForms[0] + '?' + 'opcao=atualizar&'
									+ params[1]);
				}else {
					if ((param_value != "comprarIngresso")){
						
					
					$('#formCadastro').attr(
							'action',
							paramsForms[0] + '?' + 'pAcao=6&'
									+ params[1]);
					}
					
				}
				
				opentab(2);
			} else if ((param_value == "enviar") || (param_value == "novo") || (param_value == "7")||(param_value == "salvar") ) {
				opentab(2);
			}

		});

function opentab(num) {
	$("#content > div").hide();
	$("#content > div:eq(" + (num - 1) + ")").fadeIn();
	$("#tabs > a").css("background", "#333399");
	$("#tabs > a").css("color", "silver");
	$("#tabs > a:eq(" + (num - 1) + ")").css("background",
			"url('imagens/icones/imagemBotaoHover.png')");
	$("#tabs > a:eq(" + (num - 1) + ")").css("color", "black");
}
